<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>骑手注册</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../layui/css/layui.css"  media="all">
</head>

<body>
<form class="layui-form" action="">
    <div class="layui-form-item">
        <label class="layui-form-label">验证身份证</label>
        <div class="layui-input-block">
            <input type="text" name="idNumber" lay-verify="identity" placeholder="" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn"  lay-submit="submitBut" lay-filter="submitBut" id="submitBut">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script src="../../jQuery/jquery-3.6.0.js"></script>
<script src="../../layui/layui.js" charset="utf-8"></script>
<script>
    //Dem
    layui.use('form', function(){
        var form = layui.form
        form.on('submit(submitBut)', function(data){
         var orderform = JSON.parse(localStorage.getItem("username"))
         var id;
         if (orderform != null){
             id = orderform.username
         }
        var loading = layer.msg('正在注册骑手', {icon: 16, shade: 0.3, time:0});
        $.ajax({
            method:"POST",
            url:"/order/riderRegister",       //提交表单的地址
            data:{'id' : id , "idNumber" : data.idNumber },      //提交表单的数据
            success:function(res){
                layer.close(loading);
                window.location.href = "./takeorder.html"
            },
            error:function(){
                layer.close(loading);
            }
        });

        return false;  //防止表单提交两次
    });

    });
</script>
</body>
</html>